<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>

    <script src="drag.js"></script>
    <script src="limitDrag.js"></script>
  </head>
  <body>
    <div id="div1">1拖拽</div>
    <div id="div2">2拖拽</div>
    <script type="text/javascript">
      var drag = new Drag("div1");
      var drag2 = new limitDrag("div2");
      drag.init();
      drag2.init();
    </script>
  </body>
  <style type="text/css" media="screen">
    #div1,
    #div2 {
      width: 300px;
      height: 500px;
      background: #48d69d;
      position: absolute;
      color: #fff;
    }

    #div2 {
      width: 130px;
      height: 150px;
      background: #fc011a;
      color: #fff;
    }
  </style>
</html>
